package com.dh.cb;

import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;

public class LoadHandler {

    private ArrayBlockingQueue<LoadTask> tasks = new ArrayBlockingQueue<>(5);

    public void offer(List<String> rows, int index) {
        LoadTask loaderTask = new LoadTask(rows, index);
        tasks.offer(loaderTask);
    }

    public LoadTask poll() {
        LoadTask task = null;
        try {
            task = tasks.take();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return task;
    }
}
